package com.itboye.pondteam.presenter;

import com.itboye.pondteam.bean.PersonDataBean;
import com.itboye.pondteam.interfaces.IUserInfoInterface;
import com.itboye.pondteam.responsitory.UserResponsitory;
import com.itboye.pondteam.utils.StatisticalDataType;
import com.itboye.pondteam.volley.BasePresenter;
import com.itboye.pondteam.volley.ICompleteListener;
import com.itboye.pondteam.volley.ResultEntity;

import java.util.Observer;


/**
 * Created by admin on 2016/11/28.
 */

public class UserPresenter extends BasePresenter implements
        IUserInfoInterface<PersonDataBean> {
    public static String aq118ExtraUpdate_success = "_aq118ExtraUpdate_success";
    public static String aq118ExtraUpdate_fail = "_aq118ExtraUpdate_fail";
    public static String deviceSet_aq118_success = "_deviceSet_aq118_success";
    public static String deviceSet_aq118_fail = "_deviceSet_aq118_fail";
    public static String deviceSet_feeder_success = "_deviceSet_feeder_success";
    public static String deviceSet_feeder_fail = "_deviceSet_feeder_fail";
    public static String getForumListIndex_success = "_getForumListIndex_success";
    public static String getForumListIndex_fail = "_getForumListIndex_fail";
    public static String By_Bbs_addPost_success = "_By_Bbs_addPost_success";
    public static String By_Bbs_addPost_fail = "_By_Bbs_addPost_fail";
    public static String By_Bbs_detail_success = "_By_Bbs_detail_success";
    public static String By_Bbs_detail_fail = "_By_Bbs_detail_fail";
    public static String By_Bbs_listReply_success = "_By_Bbs_listReply_success";
    public static String By_Bbs_listReply_fail = "_By_Bbs_listReply_fail";
    public static String By_Bbs_addReply_success = "_By_Bbs_addReply_success";
    public static String By_Bbs_addReply_fail = "_By_Bbs_addReply_fail";
    public static String By_Bbs_myPost_success = "_By_Bbs_myPost_success";
    public static String By_Bbs_myPost_fail = "_By_Bbs_myPost_fail";
    public static String By_Bbs_delPost_success = "_By_Bbs_delPost_success";
    public static String By_Bbs_delPost_fail = "_By_Bbs_delPost_fail";
    public static String By_Bbs_delReply_success = "_By_Bbs_delReply_success";
    public static String By_Bbs_delReply_fail = "_By_Bbs_delReply_fail";
    public static String petFeederExtra_success = "_petFeederExtra_success";
    public static String petFeederExtra_fail = "_petFeederExtra_fail";
    public static String shareStatus_success = "shareStatus_success";
    public static String shareStatus_fail = "shareStatus_fail";
    public static String videoShare_fail = "videoShare_fail";
    public static String videoShare_success = "videoShare_success";
    public static String getShareDeviceList_success = "getShareDeviceList_success";
    public static String getShareDeviceList_fail = "getShareDeviceList_fail";
    public static String getShareVideoDetail_success = "getShareVideoDetail_success";
    public static String getShareVideoDetail_fail = "getShareVideoDetail_fail";
    public static String shareDeviceLike_success = "shareDeviceLike_success";
    public static String shareDeviceLike_fail = "shareDeviceLike_fail";
    public static String queryShareComment_success = "queryShareComment_success";
    public static String queryShareComment_fail = "queryShareComment_fail";
    public static String clearPetFeederHistory_fail = "clearPetFeederHistory_fail";
    public static String clearPetFeederHistory_success = "clearPetFeederHistory_success";
    public static String shareDeviceCommentAdd_success = "shareDeviceCommentAdd_success";
    public static String shareDeviceCommentAdd_fail = "shareDeviceCommentAdd_fail";
    public static String getCameraConfig_success = "getCameraConfig_success";
    public static String getCameraConfig_fail = "getCameraConfig_fail";
    public static String updateCameraConfig_success = "updateCameraConfig_success";
    public static String updateCameraConfig_fail = "updateCameraConfig_fail";
    public static String By_ShareDevice_edit_success = "By_ShareDevice_edit_success";
    public static String By_ShareDevice_edit_fail = "By_ShareDevice_edit_fail";
    public static String pondCleanRecords_success = "pondCleanRecord_success";
    public static String pondCleanRecords_fail = "pondCleanRecords_fail";
    public static String sunsunCameraLast_SUCEESS = "sunsunCameraLast_success";
    public static String sunsunCameraLast_fail = "sunsunCameraLast_fail";
    public static String deviceSet_hew_fishbowl_SUCEESS = "deviceSet_hew_fishbowl_SUCEESS";
    public static String deviceSet_hew_fishbowl_FAIL = "deviceSet_hew_fishbowl_FAIL";
    public String setHewFishbowlExtra_SUCEESS = "setHewFishbowlExtra_SUCEESS";
    public String setHewFishbowlExtra_FAIL = "setHewFishbowlExtra_FAIL";
    public String deviceShare_attentionStatus_SUCEESS = "deviceShare_attentionStatus_SUCEESS";
    public String deviceShare_attentionStatus_fail = "deviceShare_attentionStatus_fail";
    public String deviceSet_PetDrink_SUCEESS = "deviceSet_PetDrink_SUCEESS";
    public String deviceSet_PetDrink_Fail = "deviceSet_PetDrink_Fail";
    public String setPetDrinkExtra_success = "setPetDrinkExtra_success";
    public String setPetDrinkExtra_fail = "setPetDrinkExtra_fail";
    public String deviceSet_aq610_success = "deviceSet_aq610_success";
    public String deviceSet_aq610_fail = "deviceSet_aq610_fail";
    public String deviceAQ610Extra_success = "deviceAQ610Extra_success";
    public String deviceAQ610Extra_fail = "deviceAQ610Extra_fail";
    public String deviceSet_plantWall_success="deviceSet_plantWall_success";
    public String deviceSet_plantWall_fail="deviceSet_plantWall_fail";
    public String devicePlantWallExtra_success="devicePlantWallExtra_success";
    public String devicePlantWallExtra_fail="devicePlantWallExtra_fail";

    public UserPresenter(Observer observer) {
        super(observer);
    }

    public static String cameraUnBind_success = "_cameraUnBind_success";
    public static String cameraUnBind_fail = "_cameraUnBind_fail";
    public static String deviceSet_shuiBengsuccess = "_deviceSet_shuiBengsuccess";
    public static String deviceSet_shuiBengfail = "_deviceSet_shuiBengfail";
    public static String updateJiaoZhunTime_success = "_updateJiaoZhunTime_success";
    public static String updateJiaoZhunTime_fail = "_updateJiaoZhunTime_fail";
    public static String update806ph_success = "_update806ph_success";
    public static String update806ph_fail = "_update806ph_fail";

    public static String jiaReBangExtraUpdate_success = "_jiaReBangExtraUpdate_success";
    public static String jiaReBangExtraUpdate_fail = "_jiaReBangExtraUpdate_fail";
    public static String adtExtraUpdate_success = "_adtExtraUpdate_success";
    public static String adtExtraUpdate_fail = "_adtExtraUpdate_fail";
    public static String deviceSet_led_success = "_deviceSet_led_success";
    public static String deviceSet_led_fail = "_deviceSet_led_fail";


    // 用户登录
    public static final String login_success = UserPresenter.class.getName()
            + "_User_success";
    public static final String login_fail = UserPresenter.class.getName()
            + "_User_fail";

    //注册
    public static final String register_fail = UserPresenter.class.getName()
            + "_Register_fail";
    public static final String register_success = UserPresenter.class.getName()
            + "_Register_success";
    //发送验证码
    public static String send_code_fail = "_Send_code_fail";
    public static String send_code_success = "_Send_code_success";
    //验证验证码
    public static String yanzheng_code_fail = "_yanzheng_code_fail";
    public static String yanzheng_code_success = "_yanzheng_code_success";
    //修改密码（通过验证码）
    public static String updata_pass_success = "_updata_pass_success";
    public static String updata_pass_fail = "_updata_pass_fail";
    //修改个人信息
    public static String updata_xinxi_success = "_updata_xinxi_success";
    public static String updata_xinxi_fail = "_updata_xinxi_fail";
    //修改密码（通过旧密码）
    public static String modify_pass_success = "_modify_pass_success";
    public static String modify_pass_fail = "_modify_pass_fail";
    public static String add_address_success = "_add_address_success";
    public static String add_address_fail = "_add_address_fail";


    //添加收货地址
    //删除收货地址
    //更新收货地址
    public static String update_address_success = "_update_address_success";
    public static String update_address_fail = "_update_address_fail";


    //获取用户设备列表
    public static String getMyDeviceList_success = "_getMyDeviceList_success";
    public static String getMyDeviceList_fail = "_getMyDeviceList_fail";

    //设备设置
    public static String deviceSet_success = "_deviceSet_success";
    public static String deviceSet_fail = "_deviceSet_fail";

    //设备添加
    public static String adddevice_success = "_adddevice_success";
    public static String adddevice_fail = "_adddevice_fail";

    public static String deleteDevice_success = "_deleteDevice_success";
    public static String deleteDevice_fail = "_deleteDevice_fail";

    public static String update_devicename_success = "_update_devicename_success";
    public static String update_devicename_fail = "_update_devicename_fail";


    public static String getMostNewPondDevice_success = "_getMostNewPondDevice_success";
    public static String getMostNewPondDevice_fail = "_getMostNewPondDevice_fail";


    public static String getdeviceinfosuccess = "getdeviceinfosuccess";
    public static String getdeviceinfofail = "getdeviceinfofail";

    public static String feedBack_success = "feedBack_success";
    public static String feedBack_fail = "feedBack_fail";

    public static String updateJiaReBangVersionSuccess = "_updateJiaReBangVersionSuccess";
    public static String updateJiaReBangVersionFail = "_updateJiaReBangVersionFail";
    public static String getHistoryTemper_success = "_getHistoryTemper_success";
    public static String getHistoryTemper_fail = "getHistoryTemper_fail";
    public static String update_pass_bymobile_success = "_update_pass_bymobile_success";
    public static String update_pass_bymobile_fail = "_update_pass_bymobile_fail";
    public static String registerByPhone_success = "_registerByPhone_success";
    public static String registerByPhone_fail = "_registerByPhone_fail";

    public static String authDevicePwdsuccess = "_authDevicePwdsuccess";
    public static String authDevicePwdfail = "_authDevicePwdfail";
    public static String deviceSet_806success = "_deviceSet_806success";
    public static String deviceSet_806fail = "_deviceSet_806fail";
    public static String deviceSet_806FuWeisuccess = "_deviceSet_806FuWeisuccess";
    public static String deviceSet_806FuWeifail = "_deviceSet_806FuWeifail";
    public static String cameraQuery_success = "_cameraQuery_success";
    public static String cameraQuery_fail = "_cameraQuery_fail";
    public static String cameraBind_success = "_cameraBind_success";
    public static String cameraBind_fail = "_cameraBind_fail";
    public static String deviceSet_300success = "_deviceSet_300success";
    public static String deviceSet_300fail = "_deviceSet_300fail";

    public static String beginUpdatePondTeam_success = "_beginUpdatePondTeam_success";
    public static String beginUpdatePondTeam_fail = "_beginUpdatePondTeam_fail";
    public static String shuibengExtraUpdate_success = "_shuibengExtraUpdate_success";
    public static String shuibengExtraUpdate_fail = "_shuibengExtraUpdate_fail";
    public static String getDeviceOnLineState_success = "_getDeviceOnLineState_success";
    public static String getDeviceOnLineState_fail = "_getDeviceOnLineState_success";
    public static String updateMobileMsg_fail = "_updateMobileMsg_fail";
    public static String updateMobileMsg_success = "_updateMobileMsg_success";
    public static String deviceSet_qibeng_success = "_deviceSet_qibeng_success";
    public static String deviceSet_qibeng_fail = "_deviceSet_qibeng_fail";

    public static String deviceSet_pond_feeder_success = "_deviceSet_pond_feeder_success";//池塘喂食器设置接口成功
    public static String deviceSet_pond_feeder_fail = "_deviceSet_pond_feeder_fail";//池塘喂食器设置接口失败

    public static String bindDevicesuccess = "bindDeviceSuccess";
    public static String bindDevicefail = "bindDevicefail";

    public String getBaseUrl() {
        return baseUrl;
    }

    public void setBaseUrl(String baseUrl) {
        this.baseUrl = baseUrl;
    }

    public String baseUrl = "";

    @Override
    public void getDeviceStatus(String did) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, getdeviceinfosuccess, getdeviceinfofail);
        user.getDeviceStatus(did);
    }

    @Override
    public void beginUpdatePondTeam(String did) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, beginUpdatePondTeam_success, beginUpdatePondTeam_fail);
        user.beginUpdatePondTeam(did);
    }

    @Override
    public void pondCleanRecords(String did, int pageIndex) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, pondCleanRecords_success, pondCleanRecords_fail);
        user.pondCleanRecords(did, pageIndex);
    }

    @Override
    public void deviceSet(String did, int ob_timer, String oa_name, String ob_name, String clEn, int clWeek, String clTm, String clDur, String clState, String clCfg, String uvOn, String uvOff, String uvWH, String uvCfg, String uvState, int out_state_a, int out_state_b, String oa_on_tm, String oa_off_tm, String ob_per, String oa_per, int ws_on_tm, int ws_off_tm, final String requestType) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, requestType.equals("") ? deviceSet_success : requestType, deviceSet_fail);
        user.deviceSet(did, ob_timer, oa_name, ob_name, clEn, clWeek, clTm, clDur, clState, clCfg, uvOn, uvOff, uvWH, uvCfg, uvState, out_state_a, out_state_b, oa_on_tm, oa_off_tm, ob_per, oa_per, ws_on_tm, ws_off_tm, requestType);
    }


    @Override
    public void getMostNewDevice(String did) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, getMostNewPondDevice_success, getMostNewPondDevice_fail);
        user.getMostNewDevice(did);
    }

    @Override
    public void login(String country, String username, String pwd, String appType) {
        IUserInfoInterface<PersonDataBean> user =
                getResponsitory(Tag_Success, Tag_Error, login_success, login_fail);
        user.login(country, username, pwd, appType);
    }


    @Override
    public void registerByEmail(String nickname, String contact, String country, String address, String email, String password, String code) {
        IUserInfoInterface<PersonDataBean> user =
                getResponsitory(Tag_Success, Tag_Error, register_success, register_fail);
        user.registerByEmail(nickname, contact, country, address, email, password, code);
    }

    @Override
    public void sendVerificationCode(String country, String mobile, String code_type, int appType) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, send_code_success, send_code_fail);
        user.sendVerificationCode(country, mobile, code_type, appType);
    }

    @Override
    public void YanZhengverificationCode(String country, String mobile, String code, String code_type) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, yanzheng_code_success, yanzheng_code_fail);
        user.YanZhengverificationCode(country, mobile, code, code_type);
    }

    @Override
    public void updatePassByEmail(String country, String code, String mobile, String password) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, updata_pass_success, updata_pass_fail);
        user.updatePassByEmail(country, code, mobile, password);
    }

    @Override
    public void updatePassByPhone(String sid, String country, String code, String mobile, String password) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, update_pass_bymobile_success, update_pass_bymobile_fail);
        user.updatePassByPhone(sid, country, code, mobile, password);
    }

    @Override
    public void updatePass(String country, String code, String mobile, String password) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, updata_pass_success, updata_pass_fail);
        user.updatePass(country, code, mobile, password);
    }

    @Override
    public void upadtaInformation(String uid, String types, String content) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, updata_xinxi_success, updata_xinxi_fail);
        user.upadtaInformation(uid, types, content);
    }

    @Override
    public void modifyPass(String uid, String password, String new_password) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, modify_pass_success, modify_pass_fail);
        user.modifyPass(uid, password, new_password);
    }

    @Override
    public void addressAdd(String s_id, String uid, String contactname, String mobile, String postal_code, String province, String city, String area, String detailinfo, String defaults, String country, String country_id) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, add_address_success, add_address_fail);
        user.addressAdd(s_id, uid, contactname, mobile, postal_code, province, city, area, detailinfo, defaults, country, country_id);
    }

    @Override
    public void updateAddress(String s_id, String id, String uid, String contactname, String mobile, String postal_code, String province, String city, String area, String detailinfo, String defaults, String country, String country_id) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, update_address_success, update_address_fail);
        user.updateAddress(s_id, id, uid, contactname, mobile, postal_code, province, city, area, detailinfo, defaults, country, country_id);
    }


    @Override
    public void updatePwdByPwd(String uid, String oldPass, String newPass) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, getdeviceinfosuccess, getdeviceinfofail);
        user.updatePwdByPwd(uid, oldPass, newPass);
    }


    @Override
    public void getDeviceDetailInfo(String did, String uid) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, getdeviceinfosuccess, getdeviceinfofail);
        user.getDeviceDetailInfo(did, uid);
    }

    public void getDeviceDetailInfo(String did, String uid, String type) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, type, getdeviceinfofail);
        user.getDeviceDetailInfo(did, uid);
    }

    @Override
    public void bindDevice(String did, String uid) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, bindDevicesuccess, bindDevicefail);
        user.bindDevice(did, uid);
    }

    @Override
    public void getMyDeviceList(String uid) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, getMyDeviceList_success, getMyDeviceList_fail);
        user.getMyDeviceList(uid);
    }

    @Override
    public void deviceSet_jiarebang(String did, String t_set, String t_cyc, String cfg, String dev_lock) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, deviceSet_success, deviceSet_fail);
        user.deviceSet_jiarebang(did, t_set, t_cyc, cfg, dev_lock);
    }

    @Override
    public void addDevice(String uid, String did, String device_nickname, String device_type, String extra) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, adddevice_success, adddevice_fail);
        user.addDevice(uid, did, device_nickname, device_type, extra);
    }

    @Override
    public void deleteDevice(String id, String uid) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, deleteDevice_success, deleteDevice_fail);
        user.deleteDevice(id, uid);
    }

    @Override
    public void updateDeviceName(String id, String nickName, String chazuoA, String chazuoB, String temp_min, String temp_max, int temp_alert, int is_state_notify) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, update_devicename_success, update_devicename_fail);
        user.updateDeviceName(id, nickName, chazuoA, chazuoB, temp_min, temp_max, temp_alert, is_state_notify);
    }

    @Override
    public void getMostNewPondDevice(String did, String deviceType) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, getMostNewPondDevice_success, getMostNewPondDevice_fail);
        user.getMostNewPondDevice(did, deviceType);
    }

    @Override
    public void getDeviceGuoLvTongStatus(String did) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, getdeviceinfosuccess, getdeviceinfofail);
        user.getDeviceGuoLvTongStatus(did);
    }

    @Override
    public void getDeviceJiaReBangStatus(String did) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, getdeviceinfosuccess, getdeviceinfofail);
        user.getDeviceJiaReBangStatus(did);
    }

    @Override
    public void feedback(String deviceType, String name, String email, String tel, String uid, String text) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, feedBack_success, feedBack_fail);
        user.feedback(deviceType, name, email, tel, uid, text);
    }

    @Override
    public void updateJiaReBangVersion(String did) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, updateJiaReBangVersionSuccess, updateJiaReBangVersionFail);
        user.updateJiaReBangVersion(did);

    }

    @Override
    public void getHistoryTemper(String did, String date_type, StatisticalDataType statisticalDataType) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, getHistoryTemper_success, getHistoryTemper_fail);
        user.getHistoryTemper(did, date_type, statisticalDataType);

    }

    @Override
    public void registerByPhone(String s, String username, String code, String password, String inviteCode, String deviceToken) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, registerByPhone_success, registerByPhone_fail);
        user.registerByPhone(s, username, code, password, inviteCode, deviceToken);
    }

    @Override
    public void authDevicePwd(String did, String ctrl_pwd, String deviceType) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, authDevicePwdsuccess, authDevicePwdfail);
        user.authDevicePwd(did, ctrl_pwd, deviceType);
    }

    /**
     * @param did
     * @param tm_1
     * @param mode
     * @param out_uvc
     * @param out_sp
     * @param out_l
     * @param tMax
     * @param th
     * @param tl
     * @param l_per
     * @param uvc_per
     * @param sp_per
     * @param push_cfg Bit0：冲浪水泵异常推送设置
     *                 0：关闭，1：开启
     *                 Bit1：备用电源异常推送设置
     *                 0：关闭，1：开启
     *                 Bit2：照明灯异常推送设置
     *                 0：关闭，1：开启
     *                 Bit3：杀菌灯异常推送设置
     *                 0：关闭，1：开启
     *                 Bit4：水位异常推送设置
     *                 0：关闭，1：开启
     *                 Bit5：水温异常推送设置
     *                 0：关闭，1：开启
     * @param dev_lock
     */
    @Override
    public void deviceSet_806(String did, String tm_1, String mode, String out_uvc, String out_sp, String out_l, String tMax, String th, String tl, String l_per, String uvc_per,
                              String sp_per, String push_cfg, String dev_lock, int uv_wh, int p_wh, int l_wh, final int ph_cmd, int e1_m, int e2_m, int e1_dly, int e2_dly, String e1_per, String e2_per, int e1_s, int e2_s, final String requestType) {
        String success = "";
        String error = "";
        if (ph_cmd == 1) {
            success = (deviceSet_806FuWeisuccess);
            error = (deviceSet_806FuWeifail);
        } else if (!requestType.equals("")) {
            success = (requestType);
            error = (deviceSet_806fail);
        } else {
            success = (deviceSet_806success);
            error = (deviceSet_806fail);
        }
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, success, error);
        user.deviceSet_806(did, tm_1, mode, out_uvc, out_sp, out_l, tMax, th, tl, l_per, uvc_per, sp_per, push_cfg, dev_lock, uv_wh, p_wh, l_wh, ph_cmd, e1_m, e2_m, e1_dly, e2_dly, e1_per, e2_per, e1_s, e2_s, requestType);
    }

    @Override
    public void deviceSet_pondFeeder(String did, int dev_lock, int push_cfg, int tz, int m, int ws, int fc, String fp, int v, String requestType) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, requestType == null ? deviceSet_pond_feeder_success : requestType, deviceSet_pond_feeder_fail);
        user.deviceSet_pondFeeder(did, dev_lock, push_cfg, tz, m, ws, fc, fp, v, requestType);
    }

    @Override
    public void deviceSet_300Ph(String did, double th, double tl, double phh, double phl, int push_cfg, int dev_lock, int d_cyc, int ph_dly, int ph_cmd) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, deviceSet_300success, deviceSet_300fail);
        user.deviceSet_300Ph(did, th, tl, phh, phl, push_cfg, dev_lock, d_cyc, ph_dly, ph_cmd);
    }

    @Override
    public void deviceSet_shuiBeng(String did, int devLock, int i_cyc, int gear, int cfg, int state, int fcd, int wh, int wg, int we, int wc, int m, String per, final String requestType) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, requestType.equals("") ? deviceSet_shuiBengsuccess : requestType, deviceSet_shuiBengfail);
        user.deviceSet_shuiBeng(did, devLock, i_cyc, gear, cfg, state, fcd, wh, wg, we, wc, m, per, requestType);
    }

    @Override
    public void cameraQuery(String uid, String did, String slave_did) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, cameraQuery_success, cameraQuery_fail);
        user.cameraQuery(uid, did, slave_did);
    }

    @Override
    public void cameraBind(String uid, String master_did, String slave_did, String slave_device_type, String slave_name, String slave_pwd) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, cameraBind_success, cameraBind_fail);
        user.cameraBind(uid, master_did, slave_did, slave_device_type, slave_name, slave_pwd);
    }

    @Override
    public void cameraUnBind(String uid, String master_did, String slave_did) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, cameraUnBind_success, cameraUnBind_fail);
        user.cameraUnBind(uid, master_did, slave_did);
    }

    @Override
    public void updateJiaoZhunTime(String id, int push_cfg, int temp_low, int temp_high, int ph_low, int ph_high, long firstTime, long lastTime) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, updateJiaoZhunTime_success, updateJiaoZhunTime_fail);
        user.updateJiaoZhunTime(id, push_cfg, temp_low, temp_high, ph_low, ph_high, firstTime, lastTime);
    }

    public void deviceSet_806Ph(String id, int ph_on, int ph_h, int ph_l, int temp_on, int temp_h, int temp_l, String title1, String title2) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, update806ph_success, update806ph_fail);
        user.deviceSet_806Ph(id, ph_on, ph_h, ph_l, temp_on, temp_h, temp_l, title1, title2);
    }

    @Override
    public void jiaReBangExtraUpdate(String id, int abnormal) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, jiaReBangExtraUpdate_success, jiaReBangExtraUpdate_fail);
        user.jiaReBangExtraUpdate(id, abnormal);
    }

    @Override
    public void adtExtraUpdate(String id, String s) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, adtExtraUpdate_success, adtExtraUpdate_fail);
        user.adtExtraUpdate(id, s);
    }

    @Override
    public void deviceSet_led(String did, int mode, int push_cfg, int dev_lock, String str, int w, int b, int g, int r, int sw, String requestType) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, requestType.equals("") ? deviceSet_led_success : requestType, deviceSet_led_fail);
        user.deviceSet_led(did, mode, push_cfg, dev_lock, str, w, b, g, r, sw, requestType);
    }

    @Override
    public void shuibengExtraUpdate(String id, String push_cfg, int fcd, int state) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, shuibengExtraUpdate_success, shuibengExtraUpdate_fail);
        user.shuibengExtraUpdate(id, push_cfg, fcd, state);
    }

    @Override
    public void sendEmailCode(String customText, int code_type, int send_type) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, send_code_success, send_code_fail);
        user.sendEmailCode(customText, code_type, send_type);
    }

    @Override
    public void getDeviceOnLineState(String did, String uid) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, getDeviceOnLineState_success, getDeviceOnLineState_fail);
        user.getDeviceOnLineState(did, uid);
    }

    @Override
    public void updateMobileMsg(String sp, String device_id, String lang, String timezone) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, updateMobileMsg_success, updateMobileMsg_fail);
        user.updateMobileMsg(sp, device_id, lang, timezone);
    }

    @Override
    public void deviceSet_qibeng(String did, int dev_lock, int mode, int state, int gear, int wh, int ch_cnt, int b_life, int push_cfg) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, deviceSet_qibeng_success, deviceSet_qibeng_fail);
        user.deviceSet_qibeng(did, dev_lock, mode, state, gear, wh, ch_cnt, b_life, push_cfg);
    }


    @Override
    public void aq118ExtraUpdate(String id, double temp_l, double temp_h, int temp_on) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, aq118ExtraUpdate_success, aq118ExtraUpdate_fail);
        user.aq118ExtraUpdate(id, temp_l, temp_h, temp_on);
    }

    @Override
    public void deviceSet_aq118(String did, int dev_lock, int t_cfg, int d_cyc) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, deviceSet_aq118_success, deviceSet_aq118_fail);
        user.deviceSet_aq118(did, dev_lock, t_cfg, d_cyc);
    }

    @Override
    public void deviceSet_feeder(String did, int dev_lock, int push_cfg, int m, int ws, int fc, String fp, final String requestType) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, requestType != null ? requestType : deviceSet_feeder_success, deviceSet_feeder_fail);
        user.deviceSet_feeder(did, dev_lock, push_cfg, m, ws, fc, fp, requestType);
    }

    @Override
    public void deviceSet_pet_feeder(String did, String periodName, String video_arr, int push_cfg, int m, int ws, String fp, String url, int a, int vol, String requestType) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, requestType != null ? requestType : deviceSet_feeder_success, deviceSet_feeder_fail);
        user.deviceSet_pet_feeder(did, periodName, video_arr, push_cfg, m, ws, fp, url, a, vol, requestType);
    }


    private UserResponsitory getResponsitory(final String tagSuccess, final String tagError, final String requestSuccess, final String requestFail) {
        UserResponsitory userResponsitory = new UserResponsitory(
                new ICompleteListener() {

                    @Override
                    public void success(ResultEntity result) {
                        result.setEventTag(tagSuccess);
                        result.setEventType(requestSuccess);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }

                    @Override
                    public void failure(ResultEntity result) {
                        result.setEventTag(tagError);
                        result.setEventType(requestFail);
                        UserPresenter.this.setChanged();
                        UserPresenter.this.notifyObservers(result);
                    }
                });
        if (!getBaseUrl().equals("")) {
            userResponsitory.setBaseUrl(getBaseUrl());
        }
        return userResponsitory;
    }

    public void petFeederExtra(String id, int alert_switch, int temp_h, int temp_on) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, petFeederExtra_success, petFeederExtra_fail);
        user.petFeederExtra(id, alert_switch, temp_h, temp_on);
    }

    public void shareStatus(String uid, String cameraDid, String chiniao_wifi_camera) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, shareStatus_success, shareStatus_fail);
        user.shareStatus(uid, cameraDid, chiniao_wifi_camera);
    }

    public void videoShare(String uid, String nick, String cameraDid, String cameraPsw, String shareDeviceType, int thumbnailId, String province, String city, double lat, double lng) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, videoShare_success, videoShare_fail);
        user.videoShare(uid, nick, cameraDid, cameraPsw, shareDeviceType, thumbnailId, province, city, lat, lng);
    }

    public void getShareDeviceList(int type, String lat, String lng, int page, int size) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, getShareDeviceList_success, getShareDeviceList_fail);
        user.getShareDeviceList(type, lat, lng, page, size);
    }

    @Override
    public void getShareVideoDetail(String uid, String share_id) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, getShareVideoDetail_success, getShareVideoDetail_fail);
        user.getShareVideoDetail(uid, share_id);
    }

    public void shareDeviceLike(String uid, String share_id) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, shareDeviceLike_success, shareDeviceLike_fail);
        user.shareDeviceLike(uid, share_id);
    }

    @Override
    public void queryShareComment(int page, String share_id) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, queryShareComment_success, queryShareComment_fail);
        user.queryShareComment(page, share_id);
    }

    public void clearPetFeederHistory(String did) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, clearPetFeederHistory_success, clearPetFeederHistory_fail);
        user.clearPetFeederHistory(did);
    }

    @Override
    public void shareDeviceCommentAdd(int parent_id, String share_id, String uid, String comment) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, shareDeviceCommentAdd_success, shareDeviceCommentAdd_fail);
        user.shareDeviceCommentAdd(parent_id, share_id, uid, comment);
    }

    @Override
    public void getCameraConfig(String cameraDid, String chiniao_wifi_camera) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, getCameraConfig_success, getCameraConfig_fail);
        user.getCameraConfig(cameraDid, chiniao_wifi_camera);
    }

    @Override
    public void updateCameraConfig(String cameraDid, String chiniao_wifi_camera, int flip) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, updateCameraConfig_success, updateCameraConfig_fail);
        user.updateCameraConfig(cameraDid, chiniao_wifi_camera, flip);
    }

    @Override
    public void By_ShareDevice_edit(String id, String summary) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, By_ShareDevice_edit_success, By_ShareDevice_edit_fail);
        user.By_ShareDevice_edit(id, summary);
    }

    @Override
    public void sunsunCameraLast(String ver) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, sunsunCameraLast_SUCEESS, sunsunCameraLast_fail);
        user.sunsunCameraLast(ver);
    }

    @Override
    public void deviceSet_hew_fishbowl(String did, int devLock, int d_cyc, int push_cfg, int m, int sw, int wh, String per, int tz, String requestType) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, requestType != null ? requestType : deviceSet_hew_fishbowl_SUCEESS, deviceSet_hew_fishbowl_FAIL);
        user.deviceSet_hew_fishbowl(did, devLock, d_cyc, push_cfg, m, sw, wh, per, tz, deviceSet_806success);
    }

    @Override
    public void setHewFishbowlExtra(String id, double tl, double th, int tempOn) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, setHewFishbowlExtra_SUCEESS, setHewFishbowlExtra_FAIL);
        user.setHewFishbowlExtra(id, tl, th, tempOn);
    }

    @Override
    public void deviceShare_attentionStatus(int status, String uid, String share_id) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, deviceShare_attentionStatus_SUCEESS, deviceShare_attentionStatus_fail);
        user.deviceShare_attentionStatus(status, uid, share_id);
    }

    @Override
    public void test() {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, deviceShare_attentionStatus_SUCEESS, deviceShare_attentionStatus_fail);
        user.test();
    }

    @Override
    public void deviceSet_pet_drink(String did, int devLock, int tcfg, int hsw, int pmd, String deviceSet_hotSwitch) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, deviceSet_hotSwitch == null ? deviceSet_PetDrink_SUCEESS : deviceSet_hotSwitch, deviceSet_PetDrink_Fail);
        user.deviceSet_pet_drink(did, devLock, tcfg, hsw, pmd, deviceSet_hotSwitch);
    }

    @Override
    public void setPetDrinkExtra(String id, int temp_l, int temp_h, int lack_switch) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, setPetDrinkExtra_success, setPetDrinkExtra_fail);
        user.setPetDrinkExtra(id, temp_l, temp_h, lack_switch);
    }

    @Override
    public void deviceSet_aq610(String did, int devLock, int sw, String per, int m, int wh, int th, int tl, int sw_cyc, int cfg_t, int d_cyc, int push_cfg, int tz, String requestType) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, requestType == null ? deviceSet_aq610_success : requestType, deviceSet_aq610_fail);
        user.deviceSet_aq610(did, devLock, sw, per, m, wh, th, tl, sw_cyc, cfg_t, d_cyc, push_cfg, tz, requestType);
    }

    @Override
    public void deviceAQ610Extra(String id, int temp_l, int temp_h, int temp_switch) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, deviceAQ610Extra_success, deviceAQ610Extra_fail);
        user.deviceAQ610Extra(id, temp_l, temp_h, temp_switch);
    }

    @Override
    public void deviceSet_plantWall(String did, int devLock, int sw, String per, int m, int ws, int ww, String w_per, int d_cyc, int push_cfg, String requestType) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error,requestType==null?deviceSet_plantWall_success:requestType, deviceSet_plantWall_fail);
        user.deviceSet_plantWall(did, devLock, sw, per, m, ws, ww, w_per, d_cyc, push_cfg, requestType);
    }

    @Override
    public void devicePlantWallExtra(String id, int th, int tl, int temp_switch) {
        IUserInfoInterface<PersonDataBean> user = getResponsitory(Tag_Success, Tag_Error, devicePlantWallExtra_success, devicePlantWallExtra_fail);
        user.devicePlantWallExtra(id, th, tl, temp_switch);
    }

}
